#!/usr/bin/env python
# encoding: utf-8


from app.views.webapi import route_api
from  flask import request,jsonify,g
import requests,json,decimal

from app.common.libs.UploadService import UploadService

from app import app, db

@route_api.route("/test/upload",methods = [ "GET","POST" ])
def testUpload():
    resp = { 'code':20000,'message':'上传成功~', 'data':{}}
    file = request.files.get('file')

    resp = UploadService.uploadByFile(file)

    print(resp)

    #图# 片名称
    # imgName = img.filename

    # #图片path和名称组成图片的保存路径
    # file_path = path+imgName

    # #保存图片
    # img.save(file_path)

    # #url是图片的路径
    # url = '/static/images/'+imgName
    # print(url)
    return jsonify( resp )


